﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Simple.Services;
using Simple.Services.System.QHSEViolationCategory.Models;

namespace Simple.WebApi.Controllers.System;

/// <summary>
/// 关键作业内容管理
/// </summary>
[Route("QHSEKeyWorkContentr/[action]")]
[ApiController]
public class QHSEKeyWorkContentController : ControllerBase
{
    private readonly QHSEKeyWorkContentService _keyWorkContentService;

    public QHSEKeyWorkContentController(QHSEKeyWorkContentService keyWorkContentService)
    {
        _keyWorkContentService = keyWorkContentService;
    }
    /// <summary>
    /// 关键作业内容列表
    /// </summary>
    [HttpGet]
    [CustomAuthorize("hdv_qhse_data")]
    public async Task<AppResult> List()
    {
        List<QHSEKeyWorkContentModel> menus = await _keyWorkContentService.GetAsync();
        return AppResult.Status200OK(data: menus);
    }
    [HttpGet]
    [ValidateTimestampAndSignature]
    public async Task<AppResult> List1()
    {
        List<QHSEKeyWorkContentModel> menus = await _keyWorkContentService.GetAsync();
        return AppResult.Status200OK(data: menus);
    }
    /// <summary>
    /// 关键作业内容查询
    /// </summary>
    [HttpGet]
    [CustomAuthorize("hdv_qhse_data")]
    public async Task<AppResult> Page([FromQuery] QHSEKeyWorkContentPageInputModel model)
    {
        PageResultModel<QHSEKeyWorkContentModel> data = await _keyWorkContentService.GetPageAsync(model);
        return AppResult.Status200OK(data: data);
    }
    [HttpGet]
    [ValidateTimestampAndSignature]
    public async Task<AppResult> Page1([FromQuery] QHSEKeyWorkContentPageInputModel model)
    {
        PageResultModel<QHSEKeyWorkContentModel> data = await _keyWorkContentService.GetPageAsync(model);
        return AppResult.Status200OK(data: data);
    }
}
